<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>test</title>
<script>
function divide(num1, num2){
	if(typeof num1 != "number" || typeof num2 != "number")
		   throw new Error("divide(): 两个参数必须是数字.");
	return num1 / num2;
}

function assert(condition, message){
	if (!condition){
		throw new Error(message);
	}
}


function divide(num1, num2){
	assert(typeof num1 == "number" && typeof num2 == "number", 
		   "divide():两个参数必须是数字.");
	return num1 / num2;
}
var result = divide(10, 23);
result = divide("hi", 3);



</script>
</head>
<body>
</body>
</html> 



